import request from '@/utils/request'
// 首页
// 获取数据列表
export const getList = (data) => {
  return request.post('/transport-task-manager/page', data)
}

// 获取总计
export const getCount = () => {
  return request.get('/transport-task-manager/count')
}

// 取消
export const CancelItem = id => {
  return request.put(`/transport-task-manager/cancel/${id}`)
}

// 获取数据详情
export const getSender = (id) => {
  return request.get(`/transport-task-manager/${id}`, {
    msg: 'string',
    code: 0
  })
}

// 获取车次列表
export const getCarList = (params) => {
  return request.get('/transportLine/trips', { params })
}

// 获取车次-车辆绑定关系
export const getCarBind = (params) => {
  return request.get('/transportLine/trips/truckDrivers', { params })
}

// 手动调整发起修改
export function manualItem(data) {
  return request.put(`/transport-task-manager/adjust/${data.id}`, data)
}

// 取件作业管理
// 获取初始化数据
export const getInitData = (data) => {
  return request.post('/pickup-dispatch-task-manager/page', data)
}

// 分配快递员
export const dispatchExpress = (courierId, data) => {
  return request.put(`/pickup-dispatch-task-manager/${courierId}`, data)
}

// 获取快递员数据

export const getCourierList = (params) => {
  return request.get('/business-hall/courier/page', { params })
}

// 获取线路分页数据
export const getLineList = (data) => {
  return request.post('/transportLine/page', data)
}

// 新增线路
export const addLine = (data) => {
  return request.post('/transportLine', data)
}

// 删除线路
export const deleteLine = (id) => {
  return request.delete(`/transportLine/${id}`)
}

// 更新线路
export const updateLine = (data) => {
  return request.put(`/transportLine/${data.id}`, data)
}

// 获取线路详情
export const getLineDetail = (id) => {
  return request.get(`/transportLine/${id}`)
}

// 查询成本配置
export const getCostConfig = () => {
  return request.get('/cost-configuration-manager')
}

// 保存成本配置
export const saveCostConfig = (data) => {
  return request.post('/cost-configuration-manager', data)
}

// 添加车次
export const addTrain = (data) => {
  return request.post('/transportLine/trips', data)
}

// 删除车次
export const deleteTrain = (id) => {
  return request.delete(`/transportLine/trips/${id}`)
}

// 车辆解绑
export const unbindVehicle = (data) => {
  return request.post(`/transportLine/trips/${data.transportTripsId}/truckDrivers`, data)
}

// 获取车次详情
export const getTrainDetail = (id) => {
  return request.get(`/transportLine/trips/${id}`)
}

// 更新车次
export const updateTrain = (data) => {
  return request.put(`/transportLine/trips/${data.id}`, data)
}

// 获取已启用的车辆
export const getVehicleList = (params) => {
  return request.get('/workingTrucks', { params })
}
